<template>

  <div class="index-container" >
    <!-- 导航区域 -->
    <div class="nav" style="padding-left:50px">
      <ul>
        <li>
          <router-link to="/discovery">
            <span class="iconfont icon-find-music"></span>
            发现音乐
          </router-link>
        </li>
        <li>
          <router-link to="/playlists">
            <span class="iconfont icon-music-list"></span>
            推荐歌单
          </router-link>
        </li>
        <li>
          <router-link to="/songs">
            <span class="iconfont icon-music"></span>
            最新音乐
          </router-link>
        </li>
        <li>
          <router-link to="/mvs">
            <span class="iconfont icon-mv"></span>
            最新MV
          </router-link>
        </li>
        <li>
          <router-link to="/mysong">
            <span class="iconfont icon-mv"></span>
            我的音乐
          </router-link>
        </li>
      </ul>
    </div>
    <!-- 主体区域 -->
    <div class="main" >
      <router-view></router-view>
    </div>
    <!-- 播放标签 -->
    <div class="players" style="background-color:black" >
     <img :src="imgUrl+'?param=50y50'" alt="" style="padding-top:5px;padding-left:20px" />
    <h3 style="float:right;padding-right:310px;padding-top:16px;font-size:1em;color:white">{{namees}}</h3>
    </div>
    <div class="player"  >
      <audio :src="musicUrl" autoplay controls id="music"  > </audio>
    </div>
  </div>
</template>

<script>
import mains from '../main.js'

export default {
  name: 'index',
  data () {
    return {
      musicUrl: '',
      namees: '',
      imgUrl: ''
    }
  },
  mounted () {
    var _this = this

    mains.$on('message', function (message) {
      _this.namees = message
    })

    mains.$on('message1', function (message1) {
      _this.imgUrl = message1
    })

    // 订阅消息
    this.$pubSub.subscribe('pauseAudio', msg => {
      var audio = document.getElementById('music')
      audio.pause()
    })
  }
}
</script>

<style >
</style>
